package day7;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class Sunday {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        int i1 = c.get(Calendar.YEAR);
        c.set(i1,0,1);
        //>>>>
        int day = c.get(Calendar.DAY_OF_WEEK);
        int cha=7-day+1;//离下次周日还有几天
        c.add(Calendar.DAY_OF_MONTH,cha);//找到了年初的第一个周日。。。
        while (c.get(Calendar.YEAR)==i1){
            System.out.println(c.getTime());
            c.add(Calendar.DAY_OF_MONTH,7);
        }

//        //c.set(Calendar.YEAR,i1);
//        ///System.out.println(c.getFirstDayOfWeek());
//        int i2 = c.getActualMaximum(Calendar.WEEK_OF_YEAR);
//        SimpleDateFormat s = new SimpleDateFormat("yyyy年MM月dd日EEEE");
//        for(int i=1;i<=i2;i++){
//            c.set(Calendar.WEEK_OF_YEAR,i);
//            c.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
//            Date time = c.getTime();
//            System.out.println(s.format(time));
//        }
    }
}
